package com.ck.controller.admin;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.ck.domain.Teacher;
import com.ck.service.AdminService;

public class ShowTeacherListController extends AbstractController {

	private AdminService adminService;

	public void setAdminService(AdminService adminService) {
		this.adminService = adminService;
	}
	
	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		Map model = new HashMap();
		
		List<Teacher> teacherList = adminService.gainTeacherList();
		model.put("teacherList", teacherList);
		
		return new ModelAndView("admin/showTeacherList", model);
	}

}
